import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import pinia from "./stores";
import { setupPermission } from './permission'

// 导入Element Plus
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import zhCn from "element-plus/dist/locale/zh-cn.mjs"; //
// 导入Element Plus图标
import * as ElementPlusIconsVue from "@element-plus/icons-vue";

// 导入全局样式
import "./styles/common.scss";

const app = createApp(App);

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

// 注册权限指令
setupPermission(app)

app.use(pinia).use(router).use(ElementPlus, { locale: zhCn }).mount("#app");

export default app;
